using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace TxTReader.Core
{
    /// <summary>
    /// 文件读取器接口
    /// </summary>
    public interface IFileReader
    {
        string FilePath { get; }
        Encoding CurrentEncoding { get; }
        long TotalLines { get; }
        bool IsFileOpen { get; }

        event EventHandler<FileOpenedEventArgs>? FileOpened;
        event EventHandler<EncodingChangedEventArgs>? EncodingChanged;

        Task<bool> OpenFileAsync(string filePath, Encoding? encoding = null);
        Task<TextLine?> GetLineAsync(int lineNumber);
        Task<List<TextLine>> GetLinesAsync(int startLine, int count);
        Task<bool> ReloadWithEncodingAsync(Encoding encoding);
        void CloseFile();
    }
}
